package com.light.gamecomponents.physics;

import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.shape.Shape;
import org.anddev.andengine.extension.physics.box2d.PhysicsFactory;
import org.anddev.andengine.extension.physics.box2d.PhysicsWorld;

import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.light.gamecomponents.IGameComponents;

public class FixChainPart implements IGameComponents{
	
	protected Shape m_shape;
	protected String m_textureName;
	protected Body m_body;
	protected FixtureDef m_fixtureDef;
	

	public FixChainPart(Shape shape, String textureName, FixtureDef fixtureDef)
	{
		m_shape = shape;
		m_textureName = textureName;
		m_fixtureDef = fixtureDef;
	}
	@Override
	public void onLoadResources() {
		
	}
	@Override
	public void onLoadScene(Scene scene, PhysicsWorld physicsWorld) { 
		m_body = PhysicsFactory.createBoxBody(physicsWorld, m_shape, BodyType.StaticBody, m_fixtureDef);
		scene.attachChild(m_shape);
	}

	@Override
	public void onLoadEngine() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void unLoadResources() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void removeFromScene(Scene scene, PhysicsWorld physicsWorld) {		
		scene.detachChild(m_shape);
		physicsWorld.destroyBody(m_body);
	}
	
	public Body getBody()
	{
		return m_body;
	}
	@Override
	public void rotate(float angle) {
		// TODO Auto-generated method stub
		
	}
}